package se.ramfelt.psnfriends.model;

import android.os.Parcel;
import android.os.Parcelable;

public class ParcelableTrophies implements Parcelable {

    private final Trophies trophies;

    public ParcelableTrophies(Trophies trophies) {
        this.trophies = trophies;
    }

    public ParcelableTrophies(Parcel in) {
        this.trophies = new Trophies();
        trophies.setLevel(in.readInt());
        trophies.setPlatinum(in.readInt());
        trophies.setGold(in.readInt());
        trophies.setSilver(in.readInt());
        trophies.setBronze(in.readInt());
    }

    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(trophies.getLevel());
        dest.writeInt(trophies.getPlatinum());
        dest.writeInt(trophies.getGold());
        dest.writeInt(trophies.getSilver());
        dest.writeInt(trophies.getBronze());
    }

    public int describeContents() {
        return 0;
    }

    public Trophies getTrophies() {
        return trophies;
    }

    public static final Parcelable.Creator<ParcelableTrophies> CREATOR = new Parcelable.Creator<ParcelableTrophies>() {
        public ParcelableTrophies createFromParcel(Parcel in) {
            return new ParcelableTrophies(in);
        }

        public ParcelableTrophies[] newArray(int size) {
            return new ParcelableTrophies[size];
        }
    };
}
